package com.example.demo.dao;

import com.example.demo.config.annotation.SwitchSource;
import com.example.demo.domain.po.SystemUser;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: 聂吉泽
 * @Description:
 * @Date: create in 2021/11/4 17:33
 */
@Mapper
public interface UserMapper {

    @Select("select * from cs_user ")
    List<SystemUser> selectUsers();

    @SwitchSource("slave")
    @Insert("insert into t_user (username,password) values (#{username},#{password})")
    void insertUserSlave(@Param("username") String username, @Param("password") String password);

    @SwitchSource("master")
    @Insert("insert into cs_user (username,password) values (#{username},#{password})")
    void insertUserMaster(@Param("username") String username, @Param("password") String password);
}
